import axios from 'axios'
import apiConfig from '../utils/apiConfig'
import { api } from '../utils/apiWrapper.js'
// 获取项目状态列表
export  function getProjectStatusList(params) {
  return  api.get('/api/data/project_status', params)
}

export async function getProjectStatusListByProjectId(projectId) {
    //console.log(projectId)
    const params = { page: 1, pageSize: 20, where: { project_id: projectId } }
    const res=await getProjectStatusList(params)
  //  console.log(res)
    const data=res.records.filter(item=>item.project_id===projectId)
    return data;
}

// 获取单个项目状态
export  function getProjectStatusById(id) {
  return  api.get(`/api/data/project_status/${id}`)
}

// 创建项目状态
export  function createProjectStatus(data) {
  return  api.post('/api/data/project_status', data)
}

// 更新项目状态
export  function updateProjectStatus(id, data) {
  return  api.put(`/api/data/project_status/${id}`, data)
}

// 删除项目状态
export  function deleteProjectStatus(id) {
  return  api.delete(`/api/data/project_status/${id}`)
} 